Enter 26-letter key: AABCDEFGHIJ K LMNOPQRSTU VWXY
That key is illegal
Enter 26-letter key: BCDEFGHIJ K LMNOPQRSTU VWXYZ A
Plaintext: HAL9 000
Ciphertext: IBM9 000
The first key entered by the user is only eight characters and is short to
be a valid key. The second key attempted is of the right length but
misses the letter Z . The user gets it right at the third try.
2. Secret key cryptography scheme
Suppose that A wants to send a message to B. Both of them share the
same secret key. In order to encrypt the message, A XORs his message
with the shared secret key. B also XORs the message with his (the
same) secret key to decrypt the message.
For example, if the key is:
K ey = 0011
A’s message = 0101
A’s message XORed with the key: 0011 XOR 0101 = 0110
B receives = 0110
Applying the secret key to get the original message, B gets: 0110 XOR
key = 0101
TheXOR works for three reasons: It is associative, any binary value
XORed with itself is 0, Any binary value XORed with 0 is itself.
The advantages of secret key cryptography include performing XOR
is very fast and well tested.
The disadvantages are that the key must remain secret, exchanging
keys with someone must be done in secret, each of the communicating
pair of people needs to share a key.
Public key cryptography scheme
Here, there are two parts to the key: a secret part and a public part.
A needs to obtain his public key before sending a message to B. The B
has published his public on his homepage for anyone to download as
he likes to be contacted only via encrypted messages. A has obtained